<?php
include("../include/config.inc.php");
include("userlogincheck.php");

$sql="select * from ".tableprefix."member where member_state='1' and member_id='$userid'";
$result=$db->query($sql);
$row=$db->fetch_array($result);
$db->free_result($result);

$todo=$_REQUEST["todo"];
if(isset($todo) && $todo=="todo"){
	$nickname = $_POST['nickname'];
	if($nickname==""){
		echo "<script>alert('请输入昵称！');history.back(-1);</script>";
		exit;
	}
	$sql="update ".tableprefix."member set member_truename='$nickname' where member_id='$userid'";
	$db->query($sql);
	if(!$db->error()){
		echo "<script>alert('修改成功！');location.href='set.php';</script>";
		exit;
	}
	else{
		echo "<script>alert('数据库出错！');location.href='index.php';</script>";
		exit;
	}		
	$db->close();
	exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>修改昵称 - 网演中国粤西平台</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=9,Chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" type="text/css" href="../css/public.css">
<link rel="stylesheet" type="text/css" href="../css/publish.css">
</head>

<body>
<form action="" method="post" name="publishForm" id="publishForm">
<input name="todo" type="hidden" value="todo">
<div class="mod-form">
	<div class="form-group">		
		<div class="form-item">
			<label>账号昵称</label>
			<input type="text" maxlength="50" id="nickname" name="nickname" placeholder="修改昵称" value="<?php echo $row["member_truename"];?>">
		</div>		
	</div>
</div>
<div class="form-button"><input name="s" type="submit" id="s" value="确定修改"></div>
</form>

<div id="bottom"></div>

<footer id="bar-fixed">
	<a href="../" class="tab-item"><i class="icon-tabbar bar-home"></i>首页</a>
	<a href="../category.php" class="tab-item"><i class="icon-tabbar bar-message"></i>分类</a>
	<a href="../publish/" class="tab-item"><i class="icon-tabbar bar-publish"></i>发起</a>	
	<a href="../user/" class="tab-item active"><i class="icon-tabbar bar-user2"></i>我</a>
</footer>
</body>
</html>